package com.flight.trans.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.flight.trans.R;
import com.flight.trans.base.BaseRecyclerAdapter;
import com.flight.trans.base.BaseViewHolder;
import com.flight.trans.bean.FileBean;
import com.flight.trans.http.GlideLoader;

import java.util.List;

/**
 * 页面图片选择
 */
public class ActivityImageAdapter extends BaseRecyclerAdapter<FileBean> {

    public ActivityImageAdapter(Context mContext, List<FileBean> mList) {
        super(mContext, mList);
    }

    @Override
    public int setContentView() {
        return R.layout.adapter_activity_image;
    }

    @Override
    protected void bindData(BaseViewHolder holder, FileBean data, int position) {
        ImageView mIvImage = holder.findViewById(R.id.mIvImage);

        if(data == null){
            GlideLoader.loader(R.mipmap.icon_add_info, mIvImage);
        }else {
            GlideLoader.loader(data.getUrl() , mIvImage);
        }

        setItemClickListener(mIvImage , position);
    }
}
